import { http } from '@/http/tokenRequest';
import { doorStore } from '@/store/door';

/**
 * 刷新token
 * @returns
 */
export function refresh() {
	const useDoorStore = doorStore();
	return http.post(
		'/bsh/applet/user/loginAuth/v1',
		{},
		{
			header: {
				Host: 'apis.backend.banshenghuo.com',
				'Content-Length': '0',
				Uniontoken: useDoorStore.doorInfo.unionToken,
				Xweb_xhr: '1',
				Appsystem: '{"deviceGuid":"omuZ_4r3X2B2_irWkR-B-ZzlUDDw","deviceType":34,"appName":"bshmp","appVer":"2.3.9.1","sysType":0,"sysVer":"","sysModule":""}',
				'Package-Name': 'bsh.applet',
				'User-Agent':
					'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c37)XWEB/14315',
				'Content-Type': 'application/x-www-form-urlencoded',
				Accept: '*/*',
				'Sec-Fetch-Site': 'cross-site',
				'Sec-Fetch-Mode': 'cors',
				'Sec-Fetch-Dest': 'empty',
				Referer: 'https://servicewechat.com/wx0e185109a2afa8b9/93/page-frame.html',
				'Accept-Encoding': 'gzip, deflate',
				'Accept-Language': 'zh-CN,zh;q=0.9',
				Priority: 'u=1, i',
				Connection: 'close'
			}
		}
	);
}
